<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang='zh-cn'>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>用户登录 - 上海舜谷</title>

<!-- CSS -->
<link rel="stylesheet" href="<%=basePath%>css/bootstrap.css">
<link rel="stylesheet" href="<%=basePath%>css/form-elements.css">
<link rel="stylesheet" href="<%=basePath%>css/style.css">
<script src="<%=basePath%>js/jquery-1.8.3.js"></script>

</head>

<body>
<script type="text/javascript" href="js/md5.js"></script>
<!-- Top content -->
<div class="top-content">

  <div class="inner-bg">
    <div class="container">
      <div class="row">
        <div class="col-sm-8 col-sm-offset-2 text">
          <h1><strong>上海舜谷建筑工程管理系统</strong></h1>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-6 col-sm-offset-3 form-box">
          <div class="form-top">
            <div class="form-top-left">
              <p>输入您的用户名和密码登录：</p>
            </div>
          </div>
          <div class="form-bottom">
            <c:if test="${requestScope.msg!=null}">
              <ul type="disc">
                <li>
                    ${requestScope.msg}
                </li>
              </ul>
            </c:if>
            <form:form action="login" method="POST" accept-charset="UTF-8">
              <form role="form" action="" method="post" class="login-form">
                <div class="form-group">
                  <label class="sr-only" for="form-username">用户名</label>
                  <form:input path="name" type="text" name="form-username" placeholder="用户名" class="form-username form-control" id="form-username"/>
                </div>
                <div class="form-group">
                  <label class="sr-only" for="form-password">密码</label>
                  <form:input path="password" type="password" name="form-password" placeholder="密码" class="form-password form-control" id="form-password"/>
                </div>
                <button type="submit" class="btn" onclick="userLogin()">登录</button>
              </form>
            </form:form>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-6 col-sm-offset-3 social-login">
          <div class="social-login-buttons">
              <h3>其他登录方式</h3>
            <a class="btn btn-link-1 btn-link-1-facebook" href="#">

            </a>
            <a class="btn btn-link-3 btn-link-1-twitter" href="finda">
            </a>
            <a class="btn btn-link-2 btn-link-1-google-plus" href="#">
              <span>注册</span>
            </a>
          </div>
        </div>

      </div>
    </div>
    <h4 style="color: #0f0f0f">注意：该系统仅兼容IE9以上及其他浏览器</h4>
  </div>

</div>
<script laguage='Javascript'>
/**
 * Switch account 
 * 
 * @param  string $account 
 * @param  string $method 
 * @access public
 * @return void
 */
$(document).ready(function()
{
    $('#dataform').submit(function()
    {
        var password = $('input#verifyPassword').val();
        var rand = $('input#verifyRand').val();
        $('input#verifyPassword').val(md5(md5(password) + rand));
    });
});

function switchAccount(account, method)
{
    if(method == 'dynamic')
    {
        link = createLink('user', method, 'period=' + period + '&account=' + account);
    }
    else if(method == 'todo')
    {
        link = createLink('user', method, 'account=' + account + '&type=' + type);
    }
    else
    {
        link = createLink('user', method, 'account=' + account);
    }
    location.href=link;
}

var mailsuffix = '';
var account    = new Array();
function setDefaultEmail(num)
{
    var mailValue = $('.email_' + num).val();
    if(mailValue.indexOf('@') <= 0) return;
    if(mailValue.indexOf('@') > 0) mailValue = mailValue.substr(mailValue.indexOf('@'));
    mailsuffix = mailValue;
}

function changeEmail(num)
{
    var mailValue = $('.email_' + num).val();
    if(mailsuffix != '' && (mailValue == '' || mailValue == account[num] + mailsuffix)) $('.email_' + num).val($('.account_' + num).val() + mailsuffix);
    account[num] = $('.account_' + num).val();
}

function checkPassword(password)
{
    $('#passwordStrength').html(password == '' ? '' : passwordStrengthList[computePasswordStrength(password)]);
    $('#passwordStrength').css('display', password == '' ? 'none' : 'table-cell');
}
// Prevent login page show in a iframe modal
if(window.self !== window.top) window.top.location.href = window.location.href;

function setForm(){}
// $(document).ready(function()
// {
//     $('#account').focus();
//
//     $("#langs li > a").click(function()
//     {
//         selectLang($(this).data('value'));
//     });
//
//     var mBtn = $('#mobile');
//     mBtn.popover({html: true, container: 'body'}).click(function(event)
//     {
//         event.stopPropagation();
//         $(document).one('click', function(){$('#mobile').popover('hide');});
//     });
//     mBtn.attr('title', mBtn.attr('data-original-title'));
//     $('#login-form form').submit(function()
//     {
//         var password = $('input:password').val();
//         var rand = $('input#verifyRand').val();
//         if(password.length != 32 && typeof(md5) == 'function') $('input:password').val(md5(md5(password) + rand));
//     });
// })
</script>
</body>
</html>

